{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "f6ab9e3f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "      ACCT_FEE_median  ACCT_FEE_var  CALL_DURA_median  CALL_DURA_var  \\\n",
      "0               79.00      0.003333              9739   4.616938e+07   \n",
      "1               52.55     29.077500             11097   1.441625e+06   \n",
      "2              398.10  13800.072130              9323   4.172556e+07   \n",
      "3               35.00    199.190833             13414   3.934732e+06   \n",
      "4               96.00    533.333333             16052   1.544782e+08   \n",
      "...               ...           ...               ...            ...   \n",
      "2995            26.00      0.367500               293   4.243764e+06   \n",
      "2996            69.40   3766.023333              8842   2.383866e+07   \n",
      "2997            73.40    504.210000              5432   1.245908e+08   \n",
      "2998            30.00    315.730000               809   8.459569e+06   \n",
      "2999           280.00   5600.493333             12113   8.300487e+07   \n",
      "\n",
      "      CDR_NUM_median  CDR_NUM_var  NO_ROAM_LOCAL_CALL_DURA_median  \\\n",
      "0                164  5164.333333                               0   \n",
      "1                215  1143.000000                            9766   \n",
      "2                115  1189.333333                            3018   \n",
      "3                109    34.333333                           12206   \n",
      "4                137  1105.333333                            8714   \n",
      "...              ...          ...                             ...   \n",
      "2995               4    46.333333                             293   \n",
      "2996              28   382.333333                            4268   \n",
      "2997              35  1122.333333                            5432   \n",
      "2998              11  2665.333333                               0   \n",
      "2999              33   204.333333                            8662   \n",
      "\n",
      "      NO_ROAM_LOCAL_CALL_DURA_var  NO_ROAM_LOCAL_CDR_NUM_median  \\\n",
      "0                    0.000000e+00                             0   \n",
      "1                    8.125323e+05                           206   \n",
      "2                    1.846593e+06                            39   \n",
      "3                    5.969724e+06                            98   \n",
      "4                    6.849665e+06                            64   \n",
      "...                           ...                           ...   \n",
      "2995                 4.243764e+06                             4   \n",
      "2996                 1.240788e+07                            15   \n",
      "2997                 1.663780e+07                            31   \n",
      "2998                 1.190700e+04                             0   \n",
      "2999                 2.872039e+07                            12   \n",
      "\n",
      "      NO_ROAM_LOCAL_CDR_NUM_var  ...  CALLED_RING_median  CALLED_RING_var  \\\n",
      "0                      0.000000  ...                  19         7.000000   \n",
      "1                   1122.333333  ...                  28         5.333333   \n",
      "2                    240.333333  ...                  11        50.333333   \n",
      "3                    101.333333  ...                  33         5.333333   \n",
      "4                    201.333333  ...                  37        36.333333   \n",
      "...                         ...  ...                 ...              ...   \n",
      "2995                  46.333333  ...                   0         0.333333   \n",
      "2996                  37.000000  ...                   9        25.333333   \n",
      "2997                 367.000000  ...                   8        22.333333   \n",
      "2998                   5.333333  ...                   8        82.333333   \n",
      "2999                  30.333333  ...                   6         0.333333   \n",
      "\n",
      "      INNET_MONTH_median  INNET_MONTH_var  IS_AGREE  VIP_LVL  CREDIT_LEVEL  \\\n",
      "0                     39              1.0       1.5      0.0          65.0   \n",
      "1                      7              1.0       1.5     99.0          67.0   \n",
      "2                      2              1.0       0.5      0.0          66.0   \n",
      "3                      3              1.0       0.0      0.0          67.0   \n",
      "4                     26              1.0       0.5     99.0          65.0   \n",
      "...                  ...              ...       ...      ...           ...   \n",
      "2995                   3              1.0       0.0      0.0          67.0   \n",
      "2996                   2              1.0       0.0      0.0          67.0   \n",
      "2997                  10              1.0       0.0     99.0          67.0   \n",
      "2998                   8              1.0       1.5     49.5          67.0   \n",
      "2999                   6              1.0       1.5      0.0          66.0   \n",
      "\n",
      "      CUST_SEX  CERT_AGE  IS_LOST  \n",
      "0          NaN       NaN        0  \n",
      "1          1.0      39.0        0  \n",
      "2          1.0      42.0        0  \n",
      "3          1.0      26.0        0  \n",
      "4          1.0      39.0        0  \n",
      "...        ...       ...      ...  \n",
      "2995       1.0      54.0        1  \n",
      "2996       2.0      21.0        1  \n",
      "2997       2.0      18.0        1  \n",
      "2998       1.0      21.0        1  \n",
      "2999       NaN      26.0        1  \n",
      "\n",
      "[3000 rows x 48 columns]\n",
      "[[ 0.4772343  -0.10422784 -0.39868734 ... -0.76995764 -0.93642239\n",
      "   0.96179583]\n",
      " [-0.37677724 -0.10454129  0.07447309 ...  1.19102397  1.04184683\n",
      "  -0.34307132]\n",
      " [-0.86848086 -0.10299923 -0.19608723 ... -0.76995764  0.96191676\n",
      "  -1.64793847]\n",
      " ...\n",
      " [ 0.34783861 -0.10388586 -0.33520902 ...  1.19102397  1.04184683\n",
      "  -1.64793847]\n",
      " [ 0.69289378 -0.02667224  0.19260313 ...  1.19102397  1.04184683\n",
      "  -1.64793847]\n",
      " [-0.62370735 -0.09205543 -0.27516073 ... -0.76995764  1.04184683\n",
      "   0.96179583]]\n"
     ]
    }
   ],
   "source": [
    "# 1\n",
    "import pandas as pd\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "\n",
    "# 2\n",
    "data = pd.read_csv('communication_user.csv')\n",
    "print(data)\n",
    "X = data.iloc[:,:45]\n",
    "y = data.iloc[:,-1]\n",
    "\n",
    "#3\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=1/5, random_state=1234)\n",
    "\n",
    "#4\n",
    "scaler = StandardScaler()\n",
    "scaler.fit(X_train)\n",
    "x_stdtrain = scaler.transform(X_train)\n",
    "scaler = StandardScaler()\n",
    "scaler.fit(X_test)\n",
    "x_stdtest = scaler.transform(X_test)\n",
    "print(x_stdtrain)\n",
    "# "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "91781d43",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
